package com.yxhl.km.module.utils;

import android.app.Activity;
import android.content.pm.FeatureInfo;
import android.content.pm.PackageManager;

/**
 * Created by yxrong on 2017/6/27.
 */
public class CarameUtil {
    public  static final int SUPPORTED_CAMERA = 1;
    public  static int mIsSupportCameraFeature = -1;

    /**
    * 判断是否具有摄像头功能
    */
    public static  boolean isSupportCameraFeature(Activity context){

            PackageManager pm= context.getPackageManager();
            FeatureInfo[]  features=pm.getSystemAvailableFeatures();
            for(FeatureInfo f : features){
                if(f.name.equals(PackageManager.FEATURE_CAMERA)) {
                    mIsSupportCameraFeature = SUPPORTED_CAMERA;
                    return true;
                }
            }

        return false;
    }

}
